package org.timemanager.view;

import java.util.Iterator;

import org.afree.chart.annotations.CategoryAnnotation;
import org.afree.chart.axis.CategoryAxis;
import org.afree.chart.axis.ValueAxis;
import org.afree.chart.plot.CategoryPlot;
import org.afree.chart.renderer.category.CategoryItemRenderer;
import org.afree.data.category.CategoryDataset;
import org.afree.graphics.geom.RectShape;

import android.graphics.Canvas;
import android.util.Log;

/**
 * fix the afreechart's bug
 * since its left labels and right labels appear different font
 * @author Dereky
 *
 */
public class MyCategoryPlot extends CategoryPlot {

	public MyCategoryPlot() {
		super();
		// TODO Auto-generated constructor stub
	}

	public MyCategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis,
			ValueAxis rangeAxis, CategoryItemRenderer renderer) {
		super(dataset, domainAxis, rangeAxis, renderer);
		// TODO Auto-generated constructor stub
	}

	@Override
	protected void drawAnnotations(Canvas canvas, RectShape dataArea) {
		if (getAnnotations() != null) {
            Iterator iterator = getAnnotations().iterator();
            while (iterator.hasNext()) {
                CategoryAnnotation annotation = (CategoryAnnotation) iterator
                        .next();
                Log.e("CategoryAnnotation",annotation.getClass().getName());
                annotation.draw(canvas, this, dataArea, getDomainAxis(),
                        getRangeAxis());
            }
        }
	}

}
